package org.example.jedis;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

/**
 * @author PC
 * jedis集群测试
 */
public class ClusterTest {
    public static void main(String[] args) {
        JedisCluster jedisCluster = new JedisCluster(new HostAndPort("my_hw.com", 6379));
        for (int i = 0; i < 10; i++) {
            String key = String.format("k%s", i);
            jedisCluster.set(key, String.format("v%s", i));
        }
        for (int i = 0; i < 10; i++) {
            String key = String.format("k%s", i);
            System.out.println(jedisCluster.get(key));
        }
        jedisCluster.close();
    }
}
